<?php
$section = 'member';

$titre = _LB_BOOKING_MANAGEMENT;
$smarty->assign("titre", $titre);
if(!isMemberLoggedIn()){
	redirect(APPLICATION_URL_FO."/");
}
$backlink = Session::getBackLink($section);
$id = Request::getNumber("id");
$act = Request::getIntNumber('act');
if($act == ACT_DELETE){
	
}
$booking = new Booking();
if($id <=0 || !$booking->get($id)){
	redirect(APPLICATION_URL_FO."/");
}
if($booking->ID_MEMBER != $_SESSION['memberID']){
	redirect(APPLICATION_URL_FO."/");
}
if($act == ACT_DELETE){
	$bookDetail = new Booking_detail();
	$bdID = Request::getNumber("bdID");
	$bookDetail->ID = $bdID;
	$bookDetail->ID_BOOKING = $id;
	$bookDetail->delete();
	$booking->STATUS = 0;
	$booking->update();
	Mail_Notify::insertLog($id, 0);
	redirect(APPLICATION_URL_FO."/member/booking_detail/?id={$id}");
	
}
$bookingData = Booking_detail::getbookingDetail($id);

$service = new Service_Booking();
$serviceData = $service->parseService2Array();
foreach($bookingData[$id]["TDATA"] as $data){
	$selectedDATE = date("Y-m-d",  strtotime($data["BOOKING_DATE"]));
	$selectedTIME = date("H:i:s",  strtotime($data["BOOKING_DATE"]));
}
$cfer = new Cfer(array(
	_LB_ACCUEIL => Utils::getHomeLink(),
	_LB_BOOKING_MANAGEMENT => Utils::getCurrentLink()));

$smarty->assign('cfer', $cfer);
$smarty->assign('bookingData', $bookingData[$id]);
$smarty->assign('bookingID', $id);
$smarty->assign('backlink', $backlink);
$smarty->display('member_booking_detail.html');

